﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Code.Models;
using System.Text.RegularExpressions;
using Code.BLL.Arithmetic.Comm;

namespace Code.BLL.Arithmetic
{

    internal class TC11X5 : LotteryTypeProduct
    {
        public override PlayTypeProduct GetPlayType(Models.PlayType_E playType)
        {
            //前三直选，前三组选，前二直选，前二组选，任选一,任选二,任选三,任选四,任选五,任选六,任选七,任选八
            PlayTypeProduct product;
            switch (playType)
            {
                case PlayType_E.TCQianSanZhiXuan:
                    product = new QianSanZhiShuan(regQianSanZhiShuan,playType);
                    break;
                case PlayType_E.TCQianSanZuXuan:
                    product = new ZuLiu(regQianSanZuXuan,playType); 
                    break;
                case PlayType_E.QianerZhiXuan:
                    product = new QianerZhiShuan(regQianerZhiXuan);
                    break;
                case PlayType_E.QianerZuXuan:
                    product = new ZuEr(regQianerZuXuan,playType);
                    break;
                case PlayType_E.Chose1:
                    product = new Chose1(Chose1);
                    break;
                case PlayType_E.Chose2:
                    product = new Chose2(Chose2);
                    break;
                case PlayType_E.Chose3:
                    product = new Chose3(Chose3);
                    break;
                case PlayType_E.Chose4:
                    product = new Chose4(Chose4);
                    break;
                case PlayType_E.Chose5:
                    product = new Chose5(Chose5);
                    break;
                case PlayType_E.Chose6:
                    product = new Chose6(Chose6);
                    break;
                case PlayType_E.Chose7:
                    product = new Chose7(Chose7);
                    break;
                case PlayType_E.Chose8:
                    product = new Chose8(Chose8);
                    break;
                default:
                    throw new ArgumentException("11选5没有找到当前玩法:" + playType);
            }
            product.lotteryType = LotteryType.TC11X5;
            return product;
        }
        private static Regex regQianSanZhiShuan = new Regex(@"^(?![\dab]{0,}(?<num>[\dab])[\dab]{0,}\k<num>)[\dab]{1,11}(,(?![\dab]{0,}(?<num>[\dab])[\dab]{0,}\k<num>)[\dab]{1,11}){2}$", RegexOptions.Compiled);

        private static Regex regQianSanZuXuan = RegexFormats.Chose3;

        private static Regex regQianerZhiXuan = new Regex(@"^(?![\dab]{0,}(?<num>[\dab])[\dab]{0,}\k<num>)[\dab]{1,11}(,(?![\dab]{0,}(?<num>[\dab])[\dab]{0,}\k<num>)[\dab]{1,11})$", RegexOptions.Compiled);

        private static Regex regQianerZuXuan =RegexFormats.Chose2;

        private static Regex Chose1 = RegexFormats.Chose1;

        private static Regex Chose2 = RegexFormats.Chose2;

        private static Regex Chose3 = RegexFormats.Chose3;

        private static Regex Chose4 = RegexFormats.Chose4;

        private static Regex Chose5 = RegexFormats.Chose5;

        private static Regex Chose6 = RegexFormats.Chose6;

        private static Regex Chose7 = RegexFormats.Chose7;

        private static Regex Chose8 = RegexFormats.Chose8;
    }
}
